home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / os2 / remin301.zip / DEFS.REM < prev    next >
Text File  |  1992-12-28  |  3KB  |  111 lines

  1. # ---------------------------------------------------------------------------
  2. #
  3. # DEFS.REM
  4. #
  5. # This file is a reminder script, which contains a few handy definitions.
  6. # Cut and paste as desired!
  7. #
  8. # This file is part of REMIND.
  9. # Copyright (C) 1992 by David F. Skoll
  10. #
  11. # ---------------------------------------------------------------------------
  12.  
  13. # It's handy to have symbolic constants for weekdays and month names
  14. SET Sunday    0
  15. SET Monday    1
  16. SET Tuesday   2
  17. SET Wednesday 3
  18. SET Thursday  4
  19. SET Friday    5
  20. SET Saturday  6
  21.  
  22. # ---------------------------------------------------------------------------
  23.  
  24. SET Jan 1
  25. SET Feb 2
  26. SET Mar 3
  27. SET Apr 4
  28. SET May 5
  29. SET Jun 6
  30. SET Jul 7
  31. SET Aug 8
  32. SET Sep 9
  33. SET Oct 10
  34. SET Nov 11
  35. SET Dec 12
  36.  
  37. # ---------------------------------------------------------------------------
  38.  
  39. SET January   1
  40. SET February  2
  41. SET March     3
  42. SET April     4
  43. SET May       5
  44. SET June      6
  45. SET July      7
  46. SET August    8
  47. SET September 9
  48. SET October   10
  49. SET November  11
  50. SET December  12
  51.  
  52. # ---------------------------------------------------------------------------
  53.  
  54. # A function which, given a time, returns a string in "AM/PM" format.
  55. # Unfortunately, has a leading zero.  Example call:
  56. #    set a ampm(now())
  57.  
  58. FSET ampm(x) iif(x<1:00, x+12*60+"am", \
  59.              iif(x<12:00, x+"am", \
  60.                  iif(x<13:00, x+"pm", x-12*60+"pm")))
  61.  
  62. # A function which knocks off a single leading zero from a string
  63.  
  64. FSET no_lz(s) iif(substr(s, 1, 1)=="0", substr(s, 2), s)
  65.  
  66. # ---------------------------------------------------------------------------
  67.  
  68. # Here's a tricky problem:  The 4th of July is a holiday in the U.S.
  69. # However, if it falls on a Saturday, the previous Friday is a holiday.
  70. # If it falls on a Sunday, the next Monday is a holiday.  Here's how
  71. # to do it.  NOTE that the following procedure makes the OMIT context
  72. # dependent upon the current date.  SInce it only depends on the current
  73. # year, which is not likely to change while producing a calendar, we
  74. # are fairly safe.  However, reminders with huge DELTA or BACK components
  75. # may not operate as expected.  In general, any time you make OMIT
  76. # dependent upon the current date, it's tricky and results may not be
  77. # what you expect.  You should try to make sure that the OMIT context
  78. # "near" any current reminders will not change during a calendar run.
  79.  
  80. set thisyear year(today())
  81.  
  82. OMIT 4 July MSG The real thing!
  83.  
  84. # Check for Saturday case
  85. if wkdaynum(date(thisyear, 7, 4)) == Saturday
  86.    OMIT 3 July [thisyear] MSG 4 July (observed)
  87. endif
  88.  
  89. # Check for Sunday case
  90. if wkdaynum(date(thisyear, 7, 4)) == Sunday
  91.    OMIT 5 July [thisyear] MSG 4 July (observed)
  92. endif
  93.  
  94. # ---------------------------------------------------------------------------
  95.  
  96. # Here's the since() function - quite useful for remembering how
  97. # old kids are:
  98.  
  99. fset since(x) ord(year(trigdate())-x)
  100.  
  101. # Here's an example of how to use it:
  102. REM 1 Nov ++12 MSG %"Dean's [since(1984)] birthday%" is %b.
  103.  
  104. # ---------------------------------------------------------------------------
  105.  
  106. # How do we get a double-quote into a string????  Only works on ASCII
  107. # machines
  108.  
  109. set example "The last word of this sentence is in " \
  110.     + char(34) + "quotes." + char(34)
  111.